<template>
  <div>
    <div style="display: flex;margin-bottom: 10px">
      <el-input
        placeholder="请输入社团名称"
        v-model="clubName"
        style="width: 200px;margin-left: 10px"
        clearable>
      </el-input>
      <el-button @click="getApplyJoinClubList" type="primary" style="margin-left: 10px" size="medium">查询</el-button>
    </div>

    <el-table
      :data="page.records"
      border
      style="width: 100%">
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item label="社团描述：">
              <span>{{ props.row.clubDescribe }}</span>
            </el-form-item>
            <el-form-item label="社团通知：">
              <span>{{ props.row.clubNotice }}</span>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
      <el-table-column
        fixed
        prop="id"
        label="ID"
        width="60">
      </el-table-column>
      <el-table-column
        prop="name"
        label="社团名称"
        width="120">
      </el-table-column>
      <el-table-column
        prop="clubIntroduce"
        label="社团介绍"
        width="300">
      </el-table-column>
<!--      <el-table-column-->
<!--        prop="clubDescribe"-->
<!--        label="社团描述"-->
<!--        width="250">-->
<!--      </el-table-column>-->
      <el-table-column
        prop="clubNotice"
        label="社团通知"
        width="250">
      </el-table-column>
      <el-table-column
        label="创建时间"
        width="200">
        <template slot-scope="scope">
          <i class="el-icon-time"></i>
          <span style="margin-left: 10px">{{getDateTime(scope.row.createTime)}}</span>
        </template>
      </el-table-column>
      <el-table-column

        label="状态"
        width="150">
        <el-tag size="medium">待审核</el-tag>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="prev, pager, next"
      @current-change="changeClubList"
      :page-count="page.pages"
    >
    </el-pagination>
  </div>
</template>

<script>
  import {getDateTime1} from '../../../utils/dateTimeUtil.js'
  import {getApplyJoinClubPageList, joinClub} from "../../../api/club";

  export default {
    name: "ApplyJoinClubList",
    data() {
      return {
        page: {
          total: 2,
          current: 1,
          records: [],
          pages: 2,
        },
        clubName: null,
      }
    },
    created() {
      this.getApplyJoinClubList();
    },
    methods: {
      getApplyJoinClubList() {
        getApplyJoinClubPageList({
          currentPage: this.page.current,
          clubName: this.clubName,
        }).then(res => {
          this.page = res.data;
          console.log(this.page.pages)
        })
      },
      changeClubList(val) {
        console.log(val)
        this.page.current = val;
        this.getApplyJoinClubList();
      },
      getDateTime(val) {
        return getDateTime1(val);
      }
    }

  }
</script>

<style scoped>
.demo-table-expand {
  font-size: 0;
  text-decoration: none;
  margin: 20px;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 100%;
}

</style>

